<?php
@$id = $_REQUEST['id'];
@$stockType = $_REQUEST['stockType'];

include 'header.php';

@$good = dbSelect('select name,stock from goods where id=:id',array('id'=>$id));
?>
		<div class='container'>
   			<div class='row'>
   				<div class='col-xs-2'>
   					<a href='index.php' class='btn btn-default btn-block'>返回首页</a>
   				</div>
   				<div class='col-xs-4'>
   					<div class='panel panel-primary'>
   						<div class='panel-heading'>
   							<?php if($stockType == 'inStock'){?>
   								<div class='panel-title'>商品[<?php echo $good['name'];?>]进货量</div>
   							<?php }else{?>
   								<div class='panel-title'>商品[<?php echo $good['name'];?>]出货量</div>
   							<?php }?>
   						</div>
   						<form class='form-horizontal' action="updateStockPro.php?id=<?php echo $id;?>&&stockType=<?php echo $stockType=='inStock'?'inStock':'outStock';?>" method='post'>
	   						<div class='panel-body'>
	   							<?php if(!empty($mes)){?>
   									<div class='alert alert-danger'>
   										<?php @print($mes);?>
   										<div class='close' data-dismiss='alert'>&times;</div>
   									</div>
	   							<?php }?>
	   							<div class='form-group'>
	   								<label class='col-xs-4 control-label'>库存量</label>
	   								<div class='col-xs-8'>
	   									<input class='form-control' value='<?php echo $good['stock'];?>' disabled='disabled' />
	   								</div>
	   							</div>
	   							<div class='form-group'>
	   								<?php if($stockType == 'inStock'){?>
	   									<label class='col-xs-4 control-label' for='inStock'>进货量</label>
	   								<?php }else{?>
	   									<label class='col-xs-4 control-label' for='outStock'>出货量</label>
	   								<?php }?>
	   								<div class='col-xs-8'>
	   									<?php if($stockType == 'inStock'){?>
	   										<input class='form-control' name='inStock' id='inStock' type='number' required='required' />
	   									<?php }else{?>
	   										<input class='form-control' name='outStock' id='outStock' type='number' required='required' />
	   									<?php }?>
	   								</div>
	   							</div>
	   						</div>
	   						<div class='panel-footer' style='padding-left:100px;'>
   								<button class='btn btn-primary' type='submit'>确定</button>
   								<a href='goodsList.php?listType=stock' class='btn btn-default'>返回</a>
   							</div>
   						</form>
   					</div>
   				</div>
   			</div>
   		</div>
   	</body>
</html>
